home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
WINPROGS
/
UPC12BS1.ZIP
/
UUCICO
/
MODEM.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-03
|
37KB
|
1,008 lines
/*--------------------------------------------------------------------*/
/* m o d e m . c */
/* */
/* High level modem control routines for UUPC/extended */
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
/* Changes Copyright (c) 1989-1993 by Kendra Electronic */
/* Wonderworks. */
/* */
/* All rights reserved except those explicitly granted by */
/* the UUPC/extended license agreement. */
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
/* RCS Information */
/*--------------------------------------------------------------------*/
/*
* $Id: modem.c 1.31 1993/10/03 22:34:33 ahd Exp $
*
* Revision history:
* $Log: modem.c $
* Revision 1.31 1993/10/03 22:34:33 ahd
* Insure priority values are reset when loading modem information
*
* Revision 1.30 1993/10/03 20:43:08 ahd
* Move slowWrite to script.c
*
* Revision 1.29 1993/10/01 01:17:44 ahd
* Use atol() for reading port speed
*
* Revision 1.28 1993/09/29 13:18:06 ahd
* Clear raise before calling script processor in shutDown
*
* Revision 1.28 1993/09/29 13:18:06 ahd
* Clear raise before calling script processor in shutDown
*
* Revision 1.27 1993/09/29 05:25:21 ahd
* Correct resetting of raised flag
*
* Revision 1.26 1993/09/29 04:49:20 ahd
* Allow unique signal handler for suspend port processing
*
* Revision 1.25 1993/09/28 01:38:19 ahd
* Add configurable timeout for conversation start up phase
*
* Revision 1.24 1993/09/27 04:04:06 ahd
* Normalize references to modem speed to avoid incorrect displays
*
* Revision 1.23 1993/09/27 00:45:20 ahd
* Add suspend of serial port processing from K. Rommel
*
* Revision 1.22 1993/09/25 03:07:56 ahd
* Invoke set priority functions
*
* Revision 1.21 1993/09/23 03:26:51 ahd
* Never try to autobaud a network connection
*
* Revision 1.20 1993/09/20 04:46:34 ahd
* OS/2 2.x support (BC++ 1.0 support)
* TCP/IP support from Dave Watt
* 't' protocol support
*
* Revision 1.19 1993/08/03 03:11:49 ahd
* Add Description= line
*
* Revision 1.18 1993/07/13 01:13:32 ahd
* Correct message for systems waiting forever
*
* Revision 1.17 1993/07/05 14:47:05 ahd
* Drop obsolete tag from "variablepacket"
* Set default timeout of 30 seconds for answer timeout
*
* Revision 1.16 1993/06/16 04:03:25 ahd
* Lower max wait time for NT
*
* Revision 1.15 1993/05/30 15:25:50 ahd
* Multiple driver support
*
* Revision 1.14 1993/05/30 00:04:53 ahd
* Multiple communications drivers support
*
* Revision 1.13 1993/04/15 03:21:06 ahd
* Add CD() call to hot login procedure
*
* Revision 1.12 1993/04/11 00:34:11 ahd
* Global edits for year, TEXT, etc.
*
* Revision 1.11 1993/04/05 04:35:40 ahd
* Set clear abort processing flag (norecover) from ulib.c
*
* Revision 1.10 1993/03/06 23:04:54 ahd
* make modem connected messages consistent
*
* Revision 1.9 1993/01/23 19:08:09 ahd
* Add additional shutDown() commands even when modem does not init
*
* Revision 1.8 1992/12/30 13:11:44 dmwatt
* Check for NULL brand pointer before comparing
*
* Revision 1.7 1992/12/18 12:05:57 ahd
* Flag variable packet as obsolete
*
* Revision 1.6 1992/11/28 19:51:16 ahd
* Add program exit time to waiting for callin message
* Make time parameter to callin() const
*
* Revision 1.5 1992/11/22 21:20:45 ahd
* Use strpool for const string allocation
*
* Revision 1.4 1992/11/19 03:01:21 ahd
* drop rcsid
*
* Revision 1.3 1992/11/18 03:48:24 ahd
* Move check of call window to avoid premature lock file overhead
*
* Revision 1.2 1992/11/15 20:12:17 ahd
* Clean up modem file support for different protocols
*
* Revision 1.1 1992/11/12 12:32:18 ahd
* Initial revision
*
*/
/*--------------------------------------------------------------------*/
/* System include files */
/*--------------------------------------------------------------------*/
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <limits.h>
#include <sys/types.h>
/*--------------------------------------------------------------------*/
/* UUPC/extended include files */
/*--------------------------------------------------------------------*/
#include "lib.h"
#include "hostable.h"
#include "arpadate.h"
#include "catcher.h"
#include "checktim.h"
#include "commlib.h"
#include "dater.h"
#include "dcp.h"
#include "dcpsys.h"
#include "hlib.h"
#include "modem.h"
#include "script.h"
#include "security.h"
#include "ssleep.h"
#include "suspend.h"
#include "usrcatch.h"
/*--------------------------------------------------------------------*/
/* Global variables */
/*--------------------------------------------------------------------*/
char *M_device = NULL; /*Public to show in login banner */
static char **answer, **initialize, **dropline, **ring, **connect;
static char **noconnect;
static char *dialPrefix, *dialSuffix;
static char *M_suite;
static char *dummy;
static KEWSHORT dialTimeout, modemTimeout, scriptTimeout;
static KEWSHORT answerTimeout;
static BPS inspeed;
static KEWSHORT gWindowSize, gPacketSize;
static KEWSHORT vWindowSize, vPacketSize;
static KEWSHORT GWindowSize, GPacketSize;
KEWSHORT M_charDelay;
KEWSHORT M_fPacketSize;
KEWSHORT M_gPacketTimeout; /* "g" procotol */
KEWSHORT M_fPacketTimeout; /* "f" procotol */
KEWSHORT M_tPacketTimeout; /* "t" procotol */
KEWSHORT M_startupTimeout; /* pre-procotol exchanges */
KEWSHORT M_MaxErr= 10; /* Allowed errors per single packet */
KEWSHORT M_MaxErr; /* Allowed errors per single packet */
KEWSHORT M_xfer_bufsize; /* Buffering used for file transfers */
static KEWSHORT M_priority = 999;
static KEWSHORT M_prioritydelta = 999;
boolean bmodemflag[MODEM_LAST];
static FLAGTABLE modemFlags[] = {
{ "carrierdetect", MODEM_CD, B_LOCAL },
{ "direct", MODEM_DIRECT, B_LOCAL },
{ "fixedspeed", MODEM_FIXEDSPEED, B_LOCAL },
{ "variablepacket", MODEM_VARIABLEPACKET, B_LOCAL },
{ "largepacket", MODEM_LARGEPACKET, B_LOCAL | B_OBSOLETE },
{ nil(char) }
} ;
static CONFIGTABLE modemtable[] = {
{ "answer", (char **) &answer, B_LIST | B_UUCICO },
{ "answertimeout", (char **) &answerTimeout,B_SHORT| B_UUCICO },
{ "biggpacketsize",(char **) &GPacketSize, B_SHORT| B_UUCICO },
{ "biggwindowsize",(char **) &GWindowSize, B_SHORT| B_UUCICO },
{ "chardelay", (char **) &M_charDelay, B_SHORT| B_UUCICO },
{ "connect", (char **) &connect, B_LIST | B_UUCICO },
{ "description", &dummy, B_TOKEN },
{ "device", &M_device, B_TOKEN| B_UUCICO | B_REQUIRED },
{ "dialprefix", &dialPrefix,B_STRING | B_UUCICO | B_REQUIRED },
{ "dialsuffix", &dialSuffix, B_STRING | B_UUCICO },
{ "dialtimeout", (char **) &dialTimeout, B_SHORT| B_UUCICO },
{ "fpacketsize", (char **) &M_fPacketSize,B_SHORT| B_UUCICO },
{ "fpackettimeout",(char **) &M_fPacketTimeout, B_SHORT | B_UUCICO },
{ "gpacketsize", (char **) &gPacketSize, B_SHORT| B_UUCICO },
{ "gpackettimeout",(char **) &M_gPacketT